home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1985 Summer / rerun-1985-summer-side-b.d64 / money manager (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  137 lines

  1. 100 rem ********************************
  2. 110 rem
  3. 120 rem       finance calculator
  4. 130 rem
  5. 140 rem   re-written from original pet
  6. 150 rem   program that appeared in the
  7. 160 rem   august 1978 issue of kilobaud
  8. 170 rem
  9. 180 rem this version by: robert w. baker
  10. 190 rem of 15 windsor dr, atco, nj 08004
  11. 200 rem
  12. 210 rem ********************************
  13. 220 :
  14. 230 l1$="----------------------------------------": rem 40 dashes
  15. 240 print"[147]  f i n a n c e   c a l c u l a t o r": print l1$
  16. 250 print"    investment calculations": print
  17. 260 print"1 - future value of one-time investment"
  18. 270 print"2 - future value of regular deposits"
  19. 280 print"3 - regular deposits required"
  20. 290 print"    to create a desired total value":print
  21. 300 print"    loan calculations":print
  22. 310 print"4 - regular payment on a loan"
  23. 320 print"5 - last payment on a loan"
  24. 330 print"6 - term of a loan"
  25. 340 print"7 - remaining balance on a loan"
  26. 350 print"8 - cost of borrowing": print
  27. 360 print"9 - end of program"
  28. 370 print l1$: print"    desired function (1-9): ";
  29. 380 get c$: if c$="" then 380
  30. 390 v=val(c$): if v=9 then end
  31. 400 on v gosub 420,520,630,740,850,970,1080,1200
  32. 410 run
  33. 420 print"[147]future value of one-time investment": print l1$
  34. 430 print"enter initial investment:": input i1
  35. 440 print"enter nominal interest rate:": input r
  36. 450 print"term of investment (years,months):": input y,m
  37. 460 print"number of compounding periods / year:": input n
  38. 470 r=r/n/100: y=(12*y+m)/12
  39. 480 t2=i1*(1+r)^(n*y): t2=int(t2*100+0.5)/100
  40. 490 i2=t2-i1: gosub 1380
  41. 500 gosub 1350: if a$="y" then 420
  42. 510 return
  43. 520 print"[147]future value of regular deposits": print l1$
  44. 530 print"enter amount of each deposit:": input d
  45. 540 print"enter nominal interest rate:": input r
  46. 550 print"term of investment (years,months):": input y,m
  47. 560 print"number of deposits per year:": input n
  48. 570 r=r/n/100: y=(12*y+m)/12
  49. 580 t2=d*((1+r)^(n*y)-1)/r
  50. 590 t2=int(t2*100+.5)/100
  51. 600 i1=d*y*n: i2=t2-i1: gosub 1380
  52. 610 gosub 1350: if a$="y" then 520
  53. 620 return
  54. 630 print"[147]required regular deposits": print l1$
  55. 640 print"enter the desired total value:": input t2
  56. 650 print"enter nominal interest rate:": input r
  57. 660 print"term of investment (years,months):": input y,m
  58. 670 print"number of deposits per year:": input n
  59. 680 r=r/n/100: y=(12*y+m)/12
  60. 690 d=t2*r/((1+r)^(n*y)-1): d=int(d*100+0.5)/100
  61. 700 x1=d: gosub 1430: i1=d*y*n: i2=t2-i1
  62. 710 print"regular deposits: ";x$: gosub 1380
  63. 720 gosub 1350: if a$="y" then 630
  64. 730 return
  65. 740 print"[147]regular payment on a loan": print l1$
  66. 750 print"enter the principal amount:": input p1
  67. 760 print"enter term of loan (years,months):": input y,m
  68. 770 print"enter the annual interest rate:": input r
  69. 780 print"number of payments per year:": input n
  70. 790 r=r/n/100: y=(y*12+m)/12
  71. 800 p3=1/(1+r)^(n*y): p2=p1*r/(1-p3)
  72. 810 x1=p2: gosub 1430: print l1$
  73. 820 print"regular payment: ";x$: print l1$
  74. 830 gosub 1350: if a$="y" then 740
  75. 840 return
  76. 850 print"[147]last payment on a loan": print l1$
  77. 860 print"enter the principal amount:": input p1
  78. 870 print"enter term of loan (years,months):": input y,m
  79. 880 print"enter the annual interest rate:": input r
  80. 890 print"number of payments per year:": input n
  81. 900 print"enter amount of regular payment:": input p4
  82. 910 r=r/n/100: y=(y*12+m)/12: i1=n*y
  83. 920 for i=1 to i1: r1=int(p1*r*100+0.5)/100: r2=p4-r1: p1=p1-r2: next i
  84. 930 p2=p4+p1: x1=p2: gosub 1430: print l1$
  85. 940 print"last payment: ";x$: print l1$
  86. 950 gosub 1350: if a$="y" then 850
  87. 960 return
  88. 970 print"[147]term of a loan": print l1$
  89. 980 print"enter the principal amount:": input p1
  90. 990 print"enter amount of regular payment:": input p4
  91. 1000 print"enter the annual interest rate:": input r
  92. 1010 print"number of payments per year:": input n
  93. 1020 r=r/n/100: t1=1-(p1*r/p4): t2=1+r
  94. 1030 t=-(log(t1)/log(t2))/n
  95. 1040 m=int(t*12): y=int(m/12): m=m-y*12: print l1$
  96. 1050 print"term of loan: ";y;"years,";m;"months": print l1$
  97. 1060 gosub 1350: if a$="y" then 970
  98. 1070 return
  99. 1080 print"[147]remaining balance on a loan": print l1$
  100. 1090 print"enter the principal amount:": input p1
  101. 1100 print"enter amount of regular payment:": input p4
  102. 1110 print"enter the annual interest rate:": input r
  103. 1120 print"number of payments per year:": input n
  104. 1130 print"number of payments made:": input i1
  105. 1140 r=r/n/100
  106. 1150 for i=1 to i1: r1=int(p1*r*100+0.5)/100: r2=p4-r1: p1=p1-r2: next i
  107. 1160 x1=p1: gosub 1430: print l1$
  108. 1170 print"remaining balance: ";x$: print l1$
  109. 1180 gosub 1350: if a$="y" then 1080
  110. 1190 return
  111. 1200 print"[147]cost of borrowing": print l1$
  112. 1210 print"enter the principal amount:": input p1
  113. 1220 print"enter term of loan (years,months):": input y,m
  114. 1230 print"enter the annual interest rate:": input r
  115. 1240 print"number of payments per year:": input n
  116. 1250 r=r/n/100: y=(y*12+m)/12: p3=1/(1+r)^(n*y)
  117. 1260 p4=p1*r/(1-p3): p4=int(p4*100+0.5)/100: p5=p1: c=0: i1=n*y
  118. 1270 for i=1 to i1: r1=int(p5*r*100+0.5)/100
  119. 1280 r2=p4-r1: p5=p5-r2: c=c+p4: next i
  120. 1290 c=c+p5: c1=c-p1: print l1$
  121. 1300 x1=p4: gosub 1430: print"  regular payment: ";x$
  122. 1310 x1=c: gosub 1430: print"   total payments: ";x$
  123. 1320 x1=c1: gosub 1430: print"cost of borrowing: ";x$
  124. 1330 print l1$: gosub 1350: if a$="y" then 1200
  125. 1340 return
  126. 1350 print"another calculation (y/n):"
  127. 1360 get a$: if a$<>"y" and a$<>"n" then 1360
  128. 1370 return
  129. 1380 print l1$
  130. 1390 x1=i1: gosub 1430: print"value of your investment: ";x$
  131. 1400 x1=i2: gosub 1430: print"value of accum. interest: ";x$
  132. 1410 x1=t2: gosub 1430: print"             total value: ";x$
  133. 1420 print l1$: return
  134. 1430 x1=int(x1*100+0.5)/100
  135. 1440 x2=int(x1): x3=(x1-x2)*100+1000
  136. 1450 x$="$"+str$(x2)+"."+right$(str$(x3),2): return
  137.